home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / othergnu / bc102b.zoo / readme.st < prev   
Text File  |  1992-06-20  |  6KB  |  122 lines

  1. bc 1.02 port 92/6/20
  2. --------------------
  3. This is a port of GNU bc 1.02 to atari ST.  bc is an arbitrary precision
  4. calculator language similar to C.  bc can run interactively or can read
  5. "batch" input from stdin or files.  I compiled bc with GNU C v1.40 using the
  6. MiNT libs at PL 19.  There was only one change to the source to deal with:
  7. the include of y.tab.h which bison generates as y_tab.h on the ST. It is
  8. #ifdef atarist in scan.l. (The other #ifdefs in scan.c and bc.c were done
  9. by bison and flex on their own. I used flex 2.3.7 and bison 1.14 from the
  10. gnustuff directories on atari.archive.)
  11.  
  12. I also added carriage return in the lexical analyzer in the list of chars
  13. to ignore in scan.l, i.e. from this:
  14.  
  15.     [ \t]+  { /* ignore spaces and tabs */ }
  16.  
  17. to this:
  18.  
  19.     [ \t\r]+  { /* ignore spaces and tabs (and carriage returns...)*/ }
  20.  
  21. Without this change, input files needed to to have lines terminated with
  22. newline only (not cr-nl). Now bc will accept both. I tried changing this with
  23. MiNT's `stty -crmod', UNIXMODE, etc. with no success, hence the change to the
  24. scanner.
  25.  
  26. The makefile was altered a bit.  It was generated by configure on a 4.3BSD/
  27. POSIX system as was config.h.  Changes were mainly in locations and in
  28. peculiarities in my setup.  Check it out before attempting a remake.  Note
  29. that the makefile seems somewhat flakey with dependencies.  Executable
  30. was compiled with `-O'.  The executable was stripped with xstrip, removing
  31. the symbol table and saving about 7k bytes of disk space, for the byte-hungry
  32. lharc crowd.  :-)
  33.  
  34. If present, the ./rcs directory contains changed files only. RCS rev 1.0 is
  35. the rev of the original files.
  36.  
  37. You can probably ignore GNU C's warnings about incompatible pointer types
  38. in scan.l (i.e., scan.c). This is because YY_CHAR is unsigned char and
  39. util.c:strcopyof() accepts a signed char pointer.  Same thing in this case
  40. (since all strcopyof() does is malloc space and copy the string).
  41.  
  42. I ran some of the tests in ./test with appearent success.  The libmath.b
  43. file does not need to be installed since those math functions are already
  44. builtin.  To change this, compile with `-DBC_MATH_FILE=\"<filename>\"' added
  45. to CFLAGS.  This will cause bc to load <filename> if invoked with `-l'. As it
  46. stands, you cannot redefine the functions that are provided, namely exp (e),
  47. ln (l), sin (s), cos (c), atan (a), bessel (j) if invoking bc with `-l'. You
  48. can, however, add to/replace the library by naming your own library on the
  49. command line, as in (note the absence of `-l'):
  50.  
  51.     bc mylib
  52.  
  53. The math.h file came with the distribution as-is. Note that I did build
  54. fbc.ttp and generated math.h from scratch anyway, giving an identical file
  55. as the distribution.  The default scale is thus 20.
  56.  
  57. You can build an alternate math.h by using the existing executable:
  58.  
  59.     bc -c mylib <u:/dev/null >math.h
  60.  
  61. You have to run the equivalent of fix_math.h (a shell script which invokes
  62. ed(1)) before using math.h. All the script does is:
  63.  
  64.     - add double quote (") as first char
  65.     - add backslash (\) to end of every line
  66.     - remove last line (the `@i' line)
  67.     - change trailing backslash on new last line to double quote.
  68.  
  69. This then gives a long string in C syntax which is included in global.c as
  70. math.h. Then recompile global.c and relink.  Remember that bc only allows
  71. single char function names if you do this!  Use libmath.b as a guide and RTFM.
  72.  
  73. The following files were generated:
  74.  
  75.     what:        how:
  76.  
  77.     bc.c        from bison'ing bc.y, then mv y_tab.c bc.c
  78.     y_tab.h        from bison'ing bc.y (will get clobbered if you
  79.             make sbc.ttp or fbc.ttp)
  80.     scan.c        from flex'ing scan.l, then mv lexyy.c scan.c
  81.  
  82. From what I can tell, fbc is only an intermediate form of bc, just so that
  83. the math.h file can be generated.  The `-c' flag means compile only.
  84.  
  85. The original tarfile contained these files (which were moved to the dist
  86. directory after removing the .dist extension):
  87.  
  88.     was:            now:
  89.  
  90.     ./bc.c.dist        ./dist/bc.c
  91.     ./scan.c.dist        ./dist/scan.c
  92.     ./y.tab.h.dist        ./dist/y_tab.h
  93.  
  94. I did not attempt to make sbc (which is supposed to be a POSIX-compliant
  95. bc without the GNU extensions, mainly since GNU bc is supposed to run in
  96. POSIX mode with the `-s' switch).  Note that in order to gain access to the
  97. predefined math functions in libmath.b, you must invoke bc with `-l'.
  98.  
  99. It seems to work both interactively and with stdin redirected.  I was able
  100. to suspend it from MiNT with a ^Z meaning it can sit in the background
  101. forever if you want.  Tested under MiNT 0.94 with tcsh 6.00.02 (jun92, ers).
  102. Not tested under TOS alone (since I use MiNT/tcsh now exclusively). And
  103. certainly not tested from the desktop!  :-)
  104.  
  105. There may or may not be bugs beyond what the manpage sez.  I did not test
  106. it very well nor did I check to see if the ./test/*.b files gave accurate
  107. results.  It also should be possible to do dc(1) now, if anybody uses it.
  108. Since I use a port of calc(1L) that was posted to comp.sources.unix ages
  109. ago, I don't really need dc myself.  And while I do have source to dc, I
  110. can't post it because it is derived from AT&T source.  Maybe the 4.3BSD
  111. Taho release has a dc.
  112.  
  113. The manpage source was renamed bc.man (it was called bc.1) then it was
  114. altered a bit and a manpager-ready nroff'ed manpage is in bc.1z (compressed,
  115. generated with `nroff -man -T -rO1 ...' with a bit of hand editing).  If you
  116. don't use my manpager, you'll have to regenerate the catpage (bc.1) yourself.
  117.  
  118. Enjoy...
  119.  
  120. -Bill Rosenkranz
  121. rosenkra@convex.com
  122.